﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Reflection;

namespace AppConfigVerifier
{
	public class ConfigScanner : Scanner
	{
		public ConfigScanner()
		{
		}

		public override IEnumerable<TypeToken> Scan(string content)
		{
			//string typeName = "\"(a-zA-Z0-9\\.)+\\s*,\\s*(a-zA-Z0-9\\.)+\\s*(,\\s*(Version|Culture|PublicKeyToken)=[a-zA-Z0-9\\.]+\\s*)*\"";
			var matches = Regex.Matches(content, "type=\"([^\"]+)\"").OfType<Match>();
			var typeTokens = matches.Select(
				m => new TypeToken(Location.GetLocation(m.Groups[1].Index, content), m.Groups[1].Value.Trim()));
			return typeTokens.AsEnumerable();
		}
	}
}
